import { reqCategoryList, reqGetBannerList, reqGetFloorList } from '@/api'
// home小仓库
const state = {
    categoryList: [],
    bannerList: [],
    floorList: []
}
const actions = {
    async categoryList(context) {
        const result = await reqCategoryList()
        if (result.code === 200) {
            result.data.pop()
            context.commit("CATEGORYLIST", result.data)
        }
        console.log('@@@', result);
    },
    async getBannerList({ commit }) {
        const result = await reqGetBannerList()
        if (result.code === 200) {
            commit('GETBANNERLIST', result.data)
        }
        // console.log('###', result);
    },
    async getFloorList({ commit }) {
        const result = await reqGetFloorList()
        if (result.code === 200) {
            commit('GETFLOORLIST', result.data)
        }

    }
}
const mutations = {
    CATEGORYLIST(state, categoryList) {
        state.categoryList = categoryList
    },
    GETBANNERLIST(state, bannerList) {
        state.bannerList = bannerList
    },
    GETFLOORLIST(state, floorList) {
        state.floorList = floorList
    }
}
const getters = {

}
export default {
    state,
    mutations,
    actions,
    getters
}